'''
协程的错误实现
'''

import requests
import time
import asyncio

start_time = time.time()
print("开始时间",start_time)

async def get(url):
    return requests.get(url)

async def request():
    url = 'https://www.httpbin.org/delay/5'
    print("waiting for ",url)
    response = await get(url)
    return response

tasks = [asyncio.ensure_future(request()) for _ in range(5)]

loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(tasks))

for task in tasks:
    print("task",task.result)

